<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI助理</title>
</head>
<body>
    <div>
        <input id="use" type="text"> <button onclick="send()">发送</button>
    </div>
    <div>
        <ul>
            <li></li>
        </ul>
    </div>
</body>
<script type="text/javascript" src="./assets/js/fetch.min.js"></script>
<script type="text/javascript">
    function send() {
        var headers = {
            "Content-Type": "application/json",
            "Authorization": "Bearer MFeRVNPNQdnnrdyDQrxC:rANbxQuxXCBKuhlOkHXS"
        };
        console.log('12');
        
        let content = document.querySelector('#use').value;
        let body = JSON.stringify({
            "model": "generalv3.5",
            "messages": [
                {
                    "role": "1",
                    "content": content
                }
            ],
            "stream": true
        });
        console.log('123');

    fetch('https://spark-api-open.xf-yun.com/v1/chat/completions',{
    method: "post",
    headers: headers,
    body: body
    }).then(response => response.json())
    .then(data => {
        console.log(data,"梵蒂冈地方个");
    })
    .catch(function (err) {
		console.error(err);
	})
}
</script>
</html>